package com.eyaomall.wxmall.common.helper;

import java.net.MalformedURLException;

import com.caucho.hessian.client.HessianProxyFactory;
import com.push.common.ocs.OcsService;
/**
 * 消息托送帮助类
 * @author pro
 *
 */
public class OcsHelper {
	
	private static OcsService ocsService;
	
	static {
		if (ocsService == null) {
			String serviceUrl = "http://push.fsfo2o.com/remote/ocsService";
			HessianProxyFactory factory = new HessianProxyFactory();
			factory.setOverloadEnabled(true); 
			try {
				ocsService = (OcsService) factory.create(OcsService.class, serviceUrl);
			} catch (MalformedURLException e) {
				// ...
			} 
		}
	}
	
	public static void set(String key, Object value) {
		ocsService.set(key, value);
	}
	
	public static void set(String key, Object value, int exp) {
		ocsService.set(key, value, exp);
	}
	
	public static void add(String key, Object value) {
		
		ocsService.add(key, value);
	}
	
	public static void add(String key, Object value, int exp) {
		ocsService.add(key, value, exp);
	}
	
	public static Object get(String key) {
		
		return ocsService.get(key);
	}
	
	public static boolean delete(String key) {
		
		return ocsService.delete(key);
	}
}